/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.qdu.servlet;

import com.qdu.entity.PublicActivity;
import com.qdu.service.JoinService;
import com.qdu.service.impl.PublicActivityServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.qdu.service.PublicActivityService;
import com.qdu.service.impl.JoinServiceImpl;

/**
 *
 * @author Daniel
 */
@WebServlet("/eas")
public class ExitActivityServlet extends HttpServlet {
    JoinService js = new JoinServiceImpl();
    PublicActivityService pas =new PublicActivityServiceImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        
        req.setCharacterEncoding("utf-8");
        
        int Uno = Integer.parseInt(req.getParameter("Uno")); 

        int rows =js.ExitActivity(Uno);
         
        int Pno = Integer.parseInt(req.getParameter("Pno"));
        int Pnum1 = Integer.parseInt(req.getParameter("Pnum"));
        int Pnum = Pnum1 - 1;
        
        PublicActivity newPublicActivity = new PublicActivity(Pno, Pnum);
        int rows2 = pas.joinActivity(newPublicActivity);
        
        resp.getWriter().println(rows);
        resp.getWriter().println(rows2);
        
    }
}